home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / tidy-1.000 / tidy-1 / tidy-1.0 / do-install < prev    next >
Text File  |  1996-03-12  |  2KB  |  79 lines

  1. #!/usr/bin/perl
  2.  
  3. #-----------------------------------------------------------------------------
  4. # Tidy V1.0 Installation Utility
  5. # COPYRIGHT (C) 1996 Marek Rouchal
  6. #
  7. # Please check this file and specify the paths where you want the tidy files
  8. #-----------------------------------------------------------------------------
  9.  
  10. # do not install when perl is < v5
  11. require 5.0;
  12.  
  13. # ----------------------------------------------------------------------------
  14. # Edit this paths!!
  15. #-----------------------------------------------------------------------------
  16.  
  17. # Where to put the tidy executable script
  18. $EXEC_PATH  = "/usr/sbin";
  19.  
  20. # Where to put manpages
  21. $MAN5_PATH  = "/usr/man/man5";
  22. $MAN8_PATH  = "/usr/man/man8";
  23.  
  24. # Where to put the default config file
  25. # `canonical' locations are /var/adm or /etc
  26. $CFG_PATH   = "/var/adm";
  27.  
  28. # ----------------------------------------------------------------------------
  29. # Commands used for installation
  30.  
  31. $INSTALLBIN = "install -c -m 750"; # mode rwxr-x---
  32. $INSTALLDOC = "install -c -m 644"; # mode rw-r--r--
  33.  
  34. # ----------------------------------------------------------------------------
  35. # You should not have to edit anything below
  36. #-----------------------------------------------------------------------------
  37.  
  38. # Install everything
  39. print "Installing path to configfile in tidy main script...\n";
  40. &install_cfg_path;
  41. print "Installing tidy in $EXEC_PATH...\n";
  42. `$INSTALLBIN tidy        $EXEC_PATH/tidy`;
  43. print "Installing tidy.8 in $MAN8_PATH...\n";
  44. `$INSTALLDOC tidy.8      $MAN8_PATH/tidy.8`;
  45. print "Installing tidy.5 in $MAN5_PATH...\n";
  46. `$INSTALLDOC tidy.conf.5 $MAN5_PATH/tidy.conf.5`;
  47. print "Installing tidy.conf in $CFG_PATH...\n";
  48. `$INSTALLDOC tidy.conf   $CFG_PATH/tidy.conf`;
  49. print "Done.\n";
  50. exit 0;
  51.  
  52. # This is taken from latex2html/install-test (modified).
  53. sub install_cfg_path {
  54.     local( $ok ) = 0;
  55.     if ( ( -f "tidy" ) || die "Cannot find tidy.\n" ) {
  56.         open( IN, "<tidy" ) || die "Cannot open tidy\n";
  57.         rename( "tidy", "tidy.bak" );
  58.         open(OUT, ">tidy") || die "Cannot open tidy for output\n";
  59.         chmod 0755, "tidy";
  60.         while ( <IN> ) {
  61.             if ( /^\s*\$CONFIGFILE\s*=.*$/ ) {
  62.                 $SUCCESS = 1;
  63.                 print OUT "\$CONFIGFILE = \"$CFG_PATH/tidy.conf\";\n";
  64.                 }
  65.             else
  66.                 { print OUT $_; }
  67.             }
  68.         close IN;
  69.         close OUT;
  70.         }
  71.     if ($SUCCESS) {
  72.         print "Successfully installed path to config file in main script.\n";
  73.         }
  74.     else {
  75.         die "Installation of default path to config file in main script failed.\n";
  76.         }
  77.     }
  78.  
  79.